/*
 * KIMWONSORK@GMAIL.COM
 * COPYRIGHT CRAYONSOFT All rights reserved.
 * 2013오후 9:07:00
 * kws
 */

package com.crayon.account.fragments.ui;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

import com.crayon.account.impl.OnDateChangeListener;
import com.crayon.sharemenu.R;
import com.crayon.util.UIBIND;
import com.crayon.util.UTILDate;

import java.util.Date;

/**
 * com.crayon.account.fragments.FragmentSegmentButtom
 * @author kws
 *
 */
public class FragmentDailyMove extends FragmentDateMove{

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
        super.onActivityCreated(savedInstanceState);
		UIBIND.bindView(getView(), R.id.buttonMonthToday,this);
        UIBIND.bindButton(getView(), R.id.buttonDateView, UTILDate.getYYYYMMDDwithPeriod(mDate));
    }

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch(v.getId()){
		case R.id.buttonMonthPrev:
			mDate = UTILDate.getNextDAY(mDate, -1);
			if(getOnDateChangeListener()!=null){
				getOnDateChangeListener().OnDateChange(mDate, mDate);
			}
			break;
		case R.id.buttonMonthNext:
			mDate = UTILDate.getNextDAY(mDate, 1);
			if(getOnDateChangeListener()!=null){
				getOnDateChangeListener().OnDateChange(mDate, mDate);
			}
			break;
		case R.id.buttonDateView:
			break;
		case R.id.buttonMonthToday:
			mDate.setTime(System.currentTimeMillis());;
			if(getOnDateChangeListener()!=null){
				getOnDateChangeListener().OnDateChange(mDate, mDate);
			}
			break;
		}
        UIBIND.bindButton(getView(), R.id.buttonDateView, UTILDate.getYYYYMMDDwithPeriod(mDate));
	}
}